/*
 * @Descripttion:
 * @Author: liujing
 * @Date: 2021-02-02 09:52:18
 * @LastEditTime: 2021-09-24 10:20:46
 */
import Vue from 'vue'
import Router from 'vue-router'

// 登录页面
import Login from '../pages/Login'
import Layout from '../pages/Layout/Layout'
import BlockList from '../pages/chainManagement/blockList'
import TransactionList from '../pages/chainManagement/transactionList'
import NodeInfoManage from '../pages/NodeManagement/nodeInfoManage'
import NodeInfoShow from '../pages/NodeManagement/nodeInfoShow'
import SensitiveDataUpload from '../pages/sensitiveData/sensitiveDataUpload'
import SensitiveDataShare from '../pages/sensitiveData/sensitiveDataShare'

// 注册插件
Vue.use(Router)
const originalPush = Router.prototype.push

Router.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

const router = new Router({
  mode: 'history',
  base: __dirname, // 这个很重要
  routes: [
    { path: '/login', name: 'Login', component: Login },
    {
      path: '/',
      // name: "Layout",
      component: Layout,
      meta: {
        icon: 'el-icon-s-home',
        title: '首页'
      },
      children: []
    },
    {
      path: '/',
      name: 'chainManagement',
      component: Layout,
      meta: {
        icon: 'el-icon-s-operation',
        title: '链管理'
      },
      children: [
        {
          path: 'blockList',
          name: 'blockList',
          component: BlockList,
          meta: {
            title: '区块列表'
          }
        },
        {
          path: 'transactionList',
          name: 'transactionList',
          component: TransactionList,
          meta: {
            title: '交易列表'
          }
        }
      ]
    },
    {
      path: '/',
      name: 'NodeManagement',
      component: Layout,
      meta: {
        icon: 'el-icon-share',
        title: '节点管理'
      },
      children: [
        {
          path: 'nodeInfoShow',
          name: 'nodeInfoShow',
          component: NodeInfoShow,
          meta: {
            title: '节点信息展示'
          }
        },
        {
          path: 'nodeInfoManage',
          name: 'nodeInfoManage',
          component: NodeInfoManage,
          meta: {
            title: '节点信息管理'
          }
        }
      ]
    },
    {
      path: '/',
      name: 'sensitiveData',
      component: Layout,
      meta: {
        icon: 'el-icon-notebook-1',
        title: ' 敏感数据管理'
      },
      children: [
        {
          path: 'sensitiveDataUpload',
          name: 'sensitiveDataUpload',
          component: SensitiveDataUpload,
          meta: {
            title: '敏感数据上传'
          }
        },
        {
          path: 'sensitiveDataShare',
          name: 'sensitiveDataShare',
          component: SensitiveDataShare,
          meta: {
            title: '敏感数据共享'
          }
        }
      ]
    }
  ]
})
export default router
